<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>部门管理</title>
    <%@include file="/views/common/link.jsp"%>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@include file="/views/common/navbar.jsp"%>
    <!--菜单回显-->
    <c:set var="currentMenu" value="customer"/>
    <%@include file="/views/common/menu.jsp"%>
        <div class="content-wrapper">
            <section class="content-header">
                <h1>客户管理</h1>
            </section>
            <section class="content">
                <div class="box">
                    <!--高级查询--->
                    <div style="margin: 10px;">
                        <!--高级查询--->
                        <form class="form-inline" id="searchForm" action="/customer/list" method="post">
                            <input type="hidden" name="currentPage" id="currentPage" value="1">
                            <div class="form-group">
                                <label for="keyword">关键字:</label>
                                <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword}" placeholder="请输入姓名/电话">
                            </div>
                            <div class="form-group">
                                <label for="status">状态:</label>
                                <select class="form-control" id="status" name="status">
                                    <option value="-1">全部</option>
                                    <option value="0">潜在客户</option>
                                    <option value="1">正式客户</option>
                                    <option value="4">资源池客户</option>
                                    <option value="2">失败客户</option>
                                    <option value="3">流失客户</option>
                                </select>
                                <script>
                                    $("#status option[value='${qo.status}']").prop("selected", true);
                                </script>

                            </div>

                            <div class="form-group">
                                <label for="seller">市场专员:</label>
                                <select class="form-control" id="seller" name="sellerId">
                                    <option value="-1">全部</option>

                                    <c:forEach items="${lists}" var="e">
                                        <option value="${e.id}">${e.name}</option>
                                    </c:forEach>

                                </select>
                                <script>
                                    $("#seller option[value='${qo.sellerId}']").prop("selected", true);
                                </script>
                            </div>
                            <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                        </form>
                    </div>
                    <table class="table table-striped table-hover" >
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>名称</th>
                            <th>年龄</th>
                            <th>电话</th>
                            <th>QQ</th>
                            <th>职业</th>
                            <th>来源</th>
                            <th>市场专员</th>
                            <th>状态</th>
                        </tr>
                        </thead>
                        <%
                            int i=1;
                        %>
                        <c:forEach items="${result.list}" var="entity">
                        <tr>
                            <td><%=i++%></td>
                            <td>${entity.name}</td>
                            <td>${entity.age}</td>
                            <td>${entity.tel}</td>
                            <td>${entity.qq}</td>
                            <td>${entity.job}</td>
                            <td>${entity.source}</td>
                            <td>${entity.seller}</td>
                            <td>
                            <c:choose>
                                <c:when test="${entity.status==0}">潜在客户</c:when>
                                <c:when test="${entity.status==1}">正式客户</c:when>
                                <c:when test="${entity.status==2}">失败客户</c:when>
                                <c:when test="${entity.status==3}">流失客户</c:when>
                                <c:when test="${entity.status==4}">资源池客户</c:when>
                                <c:otherwise>未分配类型</c:otherwise>
                            </c:choose>
                            </td>
                        </tr>
                        </c:forEach>
                    </table>
                    <%--<#--分页-->--%>
                    <%@include file="/views/common/page.jsp"%>
                </div>
            </section>
        </div>
    <%@include file="/views/common/footer.jsp"%>
</div>


</body>
</html>
